package cn.eeany.zutools.mapdb

import org.mapdb.DB
import org.mapdb.DBMaker

import java.util.concurrent.ConcurrentMap

DB db = DBMaker
        .fileDB("file.db")
        .fileMmapEnable()
        .make();
ConcurrentMap<String,Long> map = db
        .hashMap("mapsl", Serializer.STRING, Serializer.LONG)
        .createOrOpen();
long val = 51;
map.put(DEMO_KEY, val);
System.out.println("第1次取值，期望值：" + val + "，取到的值：" +map.get(DEMO_KEY));
db.close();
db = DBMaker
        .fileDB("file.db")
        .fileMmapEnable()
        .make();
map = db.hashMap("mapsl", Serializer.STRING, Serializer.LONG)
        .createOrOpen();
System.out.println("第2次取值，期望值：" + val + "，取到的值：" +map.get(DEMO_KEY));
db.close();